import request from "@/util/request";
import {
    type conditionQuery,
    type overviewSetmealsDataRes,
    type dateRangeQuery,
    type OrdersRejectionDTO
} from './type'
import { type Response } from '../../common'

export const conditionSearch = (params: conditionQuery) => request({
    url: '/admin/order/conditionSearch',
    method: 'GET',
    params
})

export const getBusinessData = () => request({
    url: '/admin/workspace/businessData',
    method: 'GET'
})

export const getOverviewOrders = () => request({
    url: '/admin/workspace/overviewOrders',
    method: 'GET'
})

export const getOverviewSetmeals = () => request({
    url: '/admin/workspace/overviewSetmeals',
    method: 'GET'
})

export const getOverviewDishes = () => request({
    url: '/admin/workspace/overviewDishes',
    method: 'GET'
})

export const confirm = (id: number) => request<Response>({
    url: '/admin/order/confirm',
    method: 'PUT',
    data: { id }
})

export const rejection = (data: OrdersRejectionDTO) => request<Response>({
    url: '/admin/order/rejection',
    method: 'PUT',
    data
})


export const delivery = (id: number) => request({
    url: `/admin/order/delivery/${id}`,
    method: 'PUT',
})